Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[24.2] Better cleanup of sharing roles on user purge #19096

Merged
merged 16 commits into from
Nov 21, 2024

Conversation

jdavcs
Copy link
Member

@jdavcs jdavcs commented Nov 1, 2024

Builds on top of #18966 (depends on a relocated fixture from that PR, nothing more)

Currently, a user's email address is used in a sharing role's name. It's not practical to remove it because a sharing role must be identified somehow in the UI; it is possible to pull the current email for each associated user for each sharing role, but that seems like overkill, especially when multiple sharing roles need to be displayed, each potentially associated with multiple users. Using an email in the role name is for role description only: we don't retrieve roles based on email comparison anymore (fixed in #18942).

However, when a user is purged, we don't remove their email from associated sharing roles' names. This PR fixed this: we replace the user's email in the sharing role name with the string "[USER PURGED]", so a sharing role for john and alice, after john is purged, will appear as "sharing role for [USER PURGED], alice". If this sharing role has only one user association remaining with the user being purged, the role will be deleted. This also ensures there'll be no orphan sharing roles in the db (a sharing role without an associated user).

Test included.

To do in a follow-up: handle user email updates (in api/users.py) by updating email in sharing role name.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@jdavcs jdavcs added kind/bug kind/enhancement area/admin area/database Galaxy's database or data access layer labels Nov 1, 2024
@jdavcs jdavcs requested a review from a team November 1, 2024 03:31
@github-actions github-actions bot added this to the 24.2 milestone Nov 1, 2024
lib/galaxy/webapps/galaxy/controllers/admin.py Outdated Show resolved Hide resolved
lib/galaxy/webapps/galaxy/controllers/admin.py Outdated Show resolved Hide resolved
lib/galaxy/webapps/galaxy/api/users.py Outdated Show resolved Hide resolved
@jdavcs jdavcs force-pushed the dev_update_sharing_role_name branch from bface56 to ca36655 Compare November 19, 2024 15:55
jdavcs and others added 14 commits November 20, 2024 00:47
…entDisposition function for improved UTF-8 support
apply 255 characters limit to filename
exclude `/\?%*:|"<>` characters from encoded filename
…filename

Enhance UTF-8 support for filename handling in downloads
1. Update sharing role name removing purged user email
2. If sharing role has only one user association, delete it.
3. Factor out cleanup, add test.

Note: this will not work if user email has been udpated after the sharing
role was created.
To accommodate package unit testing
@jdavcs jdavcs force-pushed the dev_update_sharing_role_name branch from ca36655 to df850ac Compare November 20, 2024 21:52
@jdavcs jdavcs changed the base branch from dev to release_24.2 November 21, 2024 14:14
@github-actions github-actions bot changed the title Better cleanup of sharing roles on user purge [24.2] Better cleanup of sharing roles on user purge Nov 21, 2024
@jdavcs jdavcs changed the title [24.2] Better cleanup of sharing roles on user purge Better cleanup of sharing roles on user purge Nov 21, 2024
@jdavcs jdavcs merged commit 191de77 into galaxyproject:release_24.2 Nov 21, 2024
61 checks passed
@github-actions github-actions bot changed the title Better cleanup of sharing roles on user purge [24.2] Better cleanup of sharing roles on user purge Nov 21, 2024
@nsoranzo nsoranzo mentioned this pull request Nov 21, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants